home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-07-05 | 2.9 KB | 109 lines | [TEXT/MPS ] |
- /************************************************************************************************/
- /* */
- /* Module Name: DNLookupByName */
- /* */
- /* File Name: DNLookupByName.c */
- /* */
- /* © Apple Computer, Inc. 1991-1995 */
- /* All Rights Reserved */
- /* */
- /* Revision History: */
- /* */
- /* Date Who Modification */
- /* */
- /* 1991-07-16 Chris Halim Original version */
- /* 1995-06-26 Jaakko Railo Version 2.0 */
- /* */
- /************************************************************************************************/
-
- /****************************************** DESCRIPTION ******************************************
-
- This module calls TELDNLookupByName to see if it can find a valid DN.
-
- *************************************************************************************************/
-
- /******************************************** HEADERS *******************************************/
-
- //#include "Strings.h"
-
- #include "TestModule.h"
-
- /****************************************** DEFINITIONS *****************************************/
-
- #define rDNNameDLOG 10000
- #define kDNName 3
-
- /****************************************** PROTOTYPES ******************************************/
-
- short GetDNName (Str255 dnName);
- void DoTest (CHRSPtr paramPtr);
-
- /************************************************************************************************/
- /************************************************************************************************/
-
-
- pascal short TestModule (CHRSPtr paramPtr)
- {
- short returnValue = noErr;
-
- if (paramPtr->version <= kTestModuleVersion) {
-
- DoTest (paramPtr);
-
- }
- else
- returnValue = kWrongVersion;
-
- return (returnValue);
- }
-
-
- short GetDNName (Str255 dnName)
- {
- short itemKind;
- Handle itemHand;
- Rect itemRect;
- short itemHit;
- DialogPtr theDialog;
-
- if ((theDialog = GetNewDialog (rDNNameDLOG, nil, (WindowPtr)(-1L))) != nil) {
- ShowWindow (theDialog);
-
- ModalDialog (nil, &itemHit);
-
- if (itemHit == ok) {
- GetDItem (theDialog, kDNName, &itemKind, &itemHand, &itemRect);
- GetIText (itemHand, dnName);
- }
-
- DisposeDialog (theDialog);
- }
- else
- itemHit = -1;
-
- return (itemHit);
- }
-
-
- void DoTest (CHRSPtr paramPtr)
- {
- TELHandle termHand = GetCurrentTELHandle (paramPtr);
- TELDNHandle dnHand;
- Str255 dnName;
- short itemHit;
- OSErr errCode;
-
- if ((itemHit = GetDNName (dnName)) == ok) {
-
- if ((errCode = TELDNLookupByName (termHand, dnName, &dnHand)) == noErr)
- Print (paramPtr, "'%*.*s' found, dnHand = %08x", dnName[0], dnName[0], &dnName[1], dnHand);
- else
- Print (paramPtr, "### Can't find '%*.*s', errCode = %d", dnName[0], dnName[0], &dnName[1], errCode);
- }
- else
- if (itemHit == -1)
- Print (paramPtr, "### Unable to get a DLOG resource");
- }
-
-
-